\ 4tH library - S>ASCII7 - Copyright 2004,2012 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

[UNDEFINED] IS-PRINT [IF]
[NEEDS lib/istype.4th]
[THEN]

[UNDEFINED] S>ASCII7 [IF]              \ strip all foreign chars
: s>ascii7                             ( a n -- a n)
  2dup bounds ?do
    i c@ dup is-print 0=               \ if printable, ignore
    if dup is-white if bl i c! else [char] ^ i c! then then drop
  loop                                 \ else replace character
;
[THEN]
